#include <iostream>
#include <vector>

void move_zero(std::vector<int>& vc)
{
    int dest = -1;
    for(int cur = 0; cur < vc.size(); cur++)
    {
        // cur：指的是已经处理过的区域
        // dest：指的是非零数的最后一个
        if(vc[cur])
        {
            int tmp = vc[cur];
            vc[cur] = vc[dest+1];
            vc[dest+1] = tmp;
            dest++;
        }
    }
}

int main()
{
    // std::vector<int> vc = {0, 1, 0, 3, 12};
    std::vector<int> vc = {1};
    move_zero(vc);
    for(int i = 0; i < vc.size(); i++)
    {
        std::cout << vc[i] << " ";
    }
    std::cout << std::endl;
    return 0;
}